package com.cavemanst.tictactoe;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity {
	
	MainSurfaceView m_mainsurfaceview;
	@Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);		
    }
	@Override
	public void onStart(){
		super.onStart();
		requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        m_mainsurfaceview = new MainSurfaceView(this);
		setContentView(m_mainsurfaceview);
	}

	@Override
	public void onBackPressed(){
		new AlertDialog.Builder(this)
		   .setMessage("Are you sure you want to exit game ?")
		   .setCancelable(false)
		   .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
			   public void onClick(DialogInterface dialog, int id) {
				   MainActivity.this.finish();
			   }
		   })
		   .setNegativeButton("No", null)
		   .show();		
	}
	@Override
	public void onStop(){
		super.onStop();
		m_mainsurfaceview = null;
		MainActivity.this.finish();
	}
}
